## [1] NA 0.000000 6.250000 75.000000 10.000000 60.000000
## [7] 80.000000 15.000000 40.000000 90.000000 7.000000 1.000000
## [13] 30.000000 5.000000 70.000000 25.000000 20.000000 2.000000
## [19] 12.000000 95.000000 97.000000 35.000000 50.000000 100.000000
## [25] 3.000000 72.000000 4.000000 0.500000 85.000000 65.000000
## [31] 12.200000 41.400000 19.100000 38.100000 33.300000 9.500000
## [37] 38.000000 8.000000 37.500000 7.500000 42.500000 45.000000
## [43] 2.500000 55.000000 98.000000 1.500000 6.000000 14.000000
## [49] 18.000000 12.500000 47.500000 49.000000 16.600000 22.000000
## [55] 83.000000 3.500000 2.450000 6.500000 46.000000 43.000000
## [61] 54.000000 28.000000 9.000000 68.000000 97.500000 13.000000
## [67] 0.100000 0.250000 36.000000 42.000000 24.000000 29.000000
## [73] 31.000000 87.000000 89.000000 84.000000 81.000000 32.000000
## [79] 73.000000 48.000000 57.000000 96.000000 53.000000 34.000000
## [85] 44.000000 39.500000 17.000000 27.000000 95.500000 56.000000
## [91] 39.000000 19.000000 94.000000 4.600000 88.000000 60.500000
## [97] 78.000000 82.000000 11.000000 21.000000 23.000000 63.000000
## [103] 99.500000 37.000000 41.000000 47.000000 0.400000 62.000000
## [109] 0.800000 91.000000 26.000000 99.000000 12.600000 87.400000
## [115] 66.000000 51.700000 48.300000 16.000000 54.540000 9.100000
## [121] 36.360000 83.800000 15.700000 2.200000 7.400000 14.700000
## [127] 18.400000 40.400000 3.470000 20.840000 68.750000 6.940000
## [133] 10.600000 5.400000 3.200000 31.900000 1.100000 92.000000
## [139] 22.200000 44.400000 71.000000 57.500000 17.500000 86.000000
## [145] 20.500000 81.250000 3.125000 31.250000 87.500000 18.750000
## [151] 56.250000 69.000000 77.000000 7.700000 15.300000 0.900000
## [157] 76.000000 33.000000 21.400000 14.300000 64.300000 23.800000
## [163] 76.200000 17.900000 7.100000 53.600000 59.000000 67.000000
## [169] 58.000000 64.000000 52.000000 0.300000 1.600000 1.800000
## [175] 53.500000 8.900000 6.800000 77.200000 0.600000 74.000000
## [181] 5.500000 38.500000 93.000000 11.500000 61.000000 108.000000
## [187] 158.500000 107.500000 4.500000 26.600000 0.370000 67.900000
## [193] 79.000000 90.500000 39.400000 19.700000 1.900000 5.800000
## [199] 18.200000 4.400000 7.300000 65.700000 15.500000 36.500000
## [205] 37.400000 0.470000 9.380000 0.280000 5.200000 46.800000
## [211] 12.300000 5.700000 11.300000 2.900000 102.000000 24.500000
## [217] 51.000000 49.500000 44.500000 41.500000 35.500000 10.500000
## [223] 8.400000 9.400000 6.300000 31.300000 85.600000 15.600000
## [229] 3.100000 18.600000 43.700000 18.700000 0.700000 45.900000
## [235] 28.100000 40.300000 62.400000 18.800000 41.200000 7.800000
## [241] 3.800000 42.400000 60.700000 1.300000 96.900000 56.300000
## [247] 43.800000 21.900000 90.600000 43.750000 62.500000 52.500000
## [253] 33.500000 4.800000 20.100000 45.100000 3.700000 37.200000
## [259] 34.100000 24.800000 52.700000 47.200000 2.800000 12.100000
## [265] 28.900000 1.250000 557.000000 46.750000 40.600000 34.400000
## [271] 58.600000 21.500000 74.500000 0.200000 56.200000 68.700000
## [277] 49.900000 25.100000 93.750000 99.900000 27.500000 8.500000
## [283] 46.500000 3.900000 70.200000 17.600000 38.400000 38.200000
## [289] 27.900000 58.700000 14.100000 68.800000 19.500000 105.000000
## [295] 99.750000 99.800000 59.500000 69.900000 17.400000 36.800000
## [301] 11.600000 48.500000 54.200000 5.600000 88.200000 4.700000
## [307] 3.400000 1.700000 36.900000 0.420000 10.300000 35.300000
## [313] 5.100000 46.300000 43.500000 3.600000 2.700000 67.500000
## [319] 4.760000 2.850000 27.600000 10.400000 24.400000 30.500000
## [325] 8.700000 0.950000 11.400000 66.700000 5.300000 19.200000
## [331] 6.100000 30.600000 35.100000 2.630000 8.800000 17.540000
## [337] 26.300000 22.600000 0.450000 13.600000 27.150000 5.330000
## [343] 14.200000 31.100000 0.440000 26.700000 30.650000 0.350000
## [349] 4.200000 21.600000 2.300000 4.620000 33.840000 29.230000
## [355] 0.770000 11.540000 15.400000 12.900000 0.340000 4.100000
## [361] 13.560000 44.100000 5.210000 11.320000 21.740000 34.780000
## [367] 9.560000 17.390000 2.580000 81.020000 12.950000 3.450000
## [373] 3.570000 36.910000 7.150000 29.760000 5.950000 11.900000
## [379] 1.190000 4.410000 41.120000 12.140000 46.740000 0.740000
## [385] 51.500000 19.110000 45.980000 1.530000 19.160000 7.760000
## [391] 9.960000 3.830000 0.380000 17.120000 26.040000 41.090000
## [397] 5.480000 10.270000 87.960000 4.630000 20.700000 0.410000
## [403] 0.830000 16.500000 9.090000 4.960000 0.010000 78.400000
## [409] 28.400000 23.500000 8.300000 88.700000 93.250000 71.875000
## [415] 15.625000 34.275000 28.125000 21.875000 1.562500 26.500000
## [421] 0.005000 32.500000 93.790000 96.870000 3.130000 12.700000
## [427] 31.500000 9.700000 35.600000 1.560000 3.120000 15.750000
## [433] 30.550000 75.500000 94.500000 63.500000 50.500000 25.500000
## [439] 66.360000 1.810000 13.800000 30.800000 24.600000 69.700000
## [445] 71.900000 21.800000 31.200000 43.200000 9.375000 12.350000
## [451] 18.900000 37.600000 50.100000 62.600000 93.700000 40.500000
## [457] 22.500000 3.300000 65.500000 75.800000 34.375000 96.875000
## [463] 59.375000 40.625000 46.875000 14.062500 65.625000 89.062500
## [469] 70.312500 28.130000 19.750000 3.150000 5.560000 11.110000
## [475] 38.890000 15.780000 23.110000 34.700000 50.870000 68.230000
## [481] 9.900000 20.540000 6.850000 3.420000 17.300000 10.960000
## [487] 2.970000 11.780000 5.880000 39.620000 36.780000 38.330000
## [493] 29.300000 12.750000 30.250000 69.800000 2.100000 15.770000
## [499] 17.660000 12.720000 6.360000 1.410000 9.600000 21.200000
## [505] 69.500000 31.400000 0.390000 2.350000 29.400000 63.750000
## [511] 0.960000 5.760000 30.760000 0.760000 52.780000 15.350000
## [517] 28.780000 4.900000 28.600000 41.600000 84.400000 7.250000
## [523] 18.100000 57.100000 7.600000 32.900000 4.300000 65.300000
## [529] 8.600000 6.400000 28.700000 23.100000 32.200000 9.800000
## [535] 51.600000 2.400000 30.200000 45.300000 16.100000 9.300000
## [541] 48.600000 57.300000 50.700000 71.100000 25.700000 6.600000
## [547] 25.200000 48.400000 25.880000 65.880000 7.140000 89.280000
## [553] 2.880000 2.170000 72.110000 94.560000 3.840000 3.260000
## [559] 30.100000 32.700000 18.500000 7.750000 56.100000 1.860000
## [565] 4.670000 71.400000 25.900000 11.100000 55.600000 72.400000
## [571] 98.440000 59.400000 2.179000 97.820000 65.600000 34.370000
## [577] 15.620000 90.620000 71.870000 84.370000 53.100000 4.685000
## [583] 4.690000 2.080000 0.781000 2.089000 29.860000 10.200000
## [589] 7.812500 7.812000 7.031000 70.310000 4.689000 13.880000
## [595] 38.880000 44.440000 1.388000 1.380000 2.340000 65.620000
## [601] 25.125000 84.375000 0.195000 101.000000 5.250000 3.750000
## [607] 85.500000 46.900000 81.300000 93.800000 21.860000 68.760000
## [613] 15.630000 18.760000 53.130000 22.860000 2.060000 40.630000
## [619] 21.880000 71.860000 1.563000 90.625000 53.125000 17.190000
## [625] 98.500000 12.090000 81.860000 5.580000 25.330000 6.180000
## [631] 3.090000 31.950000 13.700000 79.500000 12.800000 49.800000
## [637] 2.600000 2.750000 45.600000 15.200000 96.300000 88.600000
## [643] 83.600000 65.900000 28.800000 10.800000 58.900000 1.550000
## [649] 98.400000 6.200000 45.150000 78.100000 11.800000 25.600000
## [655] 33.800000 13.300000 20.800000 21.300000 8.100000 36.300000
## [661] 13.100000 35.800000 25.800000 45.800000 42.300000 26.100000
## [667] 28.500000 55.800000 19.600000 73.400000 20.300000 29.100000
## [673] 39.100000 62.700000 93.600000 64.100000 82.800000 0.780000
## [679] 88.500000 88.150000 11.850000 77.700000 88.300000 11.200000
## [685] 42.550000 39.600000 54.400000 62.800000 60.400000 77.600000
## [691] 89.200000 94.200000 34.500000 680.000000 78.500000 72.500000
## [697] 14.500000 7.197485 73.500000 0.020000 68.500000 32.800000
## [703] 26.200000 41.300000 34.300000 110.000000 60.625000 95.875000
## [709] 9.750000 78.125000 79.700000 67.800000 49.300000 74.300000
## [715] 10.900000 60.800000 7.900000 17.200000 98.600000 77.500000
## [721] 92.500000 86.500000 97.333333 1.154701 13.500000 0.050000
## [727] 0.220000 0.650000 0.030000 0.970000 0.990000 0.930000
## [733] 0.070000 0.550000 0.040000 0.150000 0.850000 0.060000
## [739] 0.580000 0.630000 0.750000 0.870000 0.120000 0.980000
## [745] 0.330000 0.008000 0.992000 0.190000 0.941000 0.009000
## [751] 0.880000 0.680000 0.240000 0.720000 0.067000 0.080000
## [757] 0.140000 0.260000 0.130000 0.290000 0.110000 0.090000
## [763] 0.180000 0.160000 0.170000 82.500000 7.330000 71.500000
## [769] 35.104131 27.666667 26.398954 18.333333 16.931233 120.000000
Here are some functions we’ll apply to each species. I’ll then fit mixed models with all of them using
with a gaussian error. Note, it’s count, so, I could use Poisson, but, that needs to be way more tuned to each model - this should be fine for a first cut?
Here’s how we’ll do it:
tseries_plot <- function(data){
ggplot(data,
aes(y = Percent_cover, x = Year,
color = Transect)) +
stat_summary(fun.data = mean_se) +
stat_summary(fun.data = mean_se, geom = "line") +
labs(color = "Transect",
y = "Percent Cover ± SE", x = "Year")
}
tseries_fun <- function(data){
glmmTMB(Percent_cover ~ Year + (1|Transect),
data = data,
family = gaussian)
}
generate_output <- function(data){
cat(paste0("## ", data$Organism[1], " ", data$Organism[1], " \n<br>"))
tseries_plot(data) %>% print()
# tseries_fun(adf) %>%
# car::Anova(test.statistic = "Chisq") %>%
# tidy() %>%
# knitr::kable("html", digits = 3) %>%
# kableExtra::kable_styling() %>%
# print
#
cat("\n\n")
}
Now let’s purrr::walk() through the whole shebang.
walk(split(data, data$Organism), generate_output)
## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?